package xyz.chenyongpeng.userconsumerdubbo.controller;

        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.web.bind.annotation.PostMapping;
        import org.springframework.web.bind.annotation.RequestMapping;
        import org.springframework.web.bind.annotation.RequestParam;
        import org.springframework.web.bind.annotation.RestController;
        import xyz.chenyongpeng.userconsumerdubbo.service.UserService;
        import xyz.chenyongpeng.utils.R;

@RestController
@RequestMapping("InfoReport")
public class InfoReportController {

    @Autowired
    private UserService userService;

    @PostMapping("/location")
    public R location(@RequestParam(name = "wx_openid", required = true) String wx_openid,
                      @RequestParam(name = "longitude", required = true) float longitude,
                      @RequestParam(name = "latitude", required = true) float latitude) {
        String u_id = userService.getUid(wx_openid);
        boolean flag = userService.reprot(Long.getLong(u_id),wx_openid,longitude,latitude);
        if (flag){
            return R.ok();
        }else {
            return R.error(500, "参数不全");
        }
    }

    @PostMapping("/infoCollect")
    public R infoCollect(@RequestParam(name = "wx_openid", required = false) String wx_openid,
                         @RequestParam(name = "wx_unnid", required = false) String wx_unnid,
                         @RequestParam(name = "funcx", required = true) String funcx,
                         @RequestParam(name = "keyx", required = true) String keyx,
                         @RequestParam(name = "longitude", required = true) String longitude,
                         @RequestParam(name = "latitude", required = true) String latitude,
                         @RequestParam(name = "from", required = true) String from) {

        String u_id = userService.getUid(wx_openid);
        return null;
    }
}
